package org.kisekiproject.log {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.filters.DropShadowFilter;
	import flash.text.TextField;

	/**
	 * Log window.
	 */
	public class LogWindow extends Sprite implements ILogger {

		private var _textField:TextField;

		/**
		 * Constructor.
		 */
		public function LogWindow() {
			mouseChildren=false;
			mouseEnabled=false;

			_textField=new TextField;
			_textField.textColor=0xffffff;

			var dropShadow:DropShadowFilter=new DropShadowFilter(0,0,0,1,4,4,2);
			_textField.filters=[dropShadow];

			addChild(_textField);
			addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
		}

		/**
		 * Added to stage.
		 */
		protected function onAddedToStage(event:Event):void {
			_textField.width=stage.stageWidth;
			_textField.height=stage.stageHeight;
		}

		/**
		 * Message.
		 */
		public function message(msg:String):void {
			_textField.appendText(msg+"\n");
			_textField.scrollV=_textField.maxScrollV;
		}
	}
}